<?php
class xml_file
    {
    public $xmlFilename = "";
    public $xml;
    public $baseDir = false;

    function readXml()
        {

        $xmlFilename=$this->xmlFilename;

        if ($xmlFilename == "")
            {
            $this->baseDir=false;
            $xmlFilename=config::$projectPath . "/db/db.xml";
            }

        if ($this->baseDir)
            {
            $xmlFilename=config::$basePath . $xmlFilename;
            }

        //$xml = simplexml_load_file($this->filename);

        /*if ($this->xmlString !== "")
            {
            $this->xml=simplexml_load_string($this->xmlString);
            }
        else
            {
            $this->xml=simplexml_load_file($xmlFilename);
            } */

        $this->xml=simplexml_load_file($xmlFilename);

        $this->xmlFilename = $xmlFilename;
        
      //  return $xml;
        }

    function writeXml() {

    
        file::createTextFile($this->xmlFilename, $this->xml->saveXML(), $this->baseDir); 
   // echo $this->xmlFilename."<br>";
    
    
    }
    
    
    
    
    }
?>